<template>
  <div>
    <!-- 搜索栏区域 -->
    <el-card class="SearchCard"
             body-style="padding:0px">
      <el-row>
        <el-col :span="2">
          <div class="SearchTitle">条件搜索栏</div>
        </el-col>
        <el-col :span="4">
          <el-row>
            <el-col :span="10">
              <div class="SearchLable">搜索关键字</div>
            </el-col>

            <el-col :span="14">
              <div class="SearchLable">
                <el-input placeholder="请输入内容"
                          v-model="queryInfo.srm"
                          clearable>
                </el-input>
              </div>
            </el-col>
          </el-row>
        </el-col>
        <el-col :span="2">
          <div class="SearchLable">
            <el-button size="medium"
                       type="primary"
                       @click="getdictDrugList()">搜索</el-button>
          </div>
        </el-col>
        <el-col :span="2">
          <div class="SearchLable">
            <el-button size="medium"
                       type="primary">添加新药</el-button>
          </div>
        </el-col>
      </el-row>
    </el-card>
    <el-card class="TableCard"
             :body-style="{ padding: '0px' }">
      <div>
        <el-table :data="dictDrugList"
                  border
                  :header-cell-style="{ background: '#3F9DFD', color: '#FFF' }"
                  size="medium"
                  stripe
                  style="width: 100%;font-size:12px">
          <el-table-column prop="drugCode"
                           label="药品编码"
                           width="100">
          </el-table-column>
          <el-table-column prop="name"
                           label="操作"
                           width="60">
            <el-button type="text"
                       size="mini"
                       @click="dialogVisible = true">编辑</el-button>
          </el-table-column>
          <el-table-column prop="drugName"
                           label="药品名称">
          </el-table-column>
          <el-table-column prop="formName"
                           label="剂型">
          </el-table-column>
          <el-table-column prop="drugSpec"
                           label="规格">
          </el-table-column>
          <el-table-column prop="cbrand"
                           label="通用名称">
          </el-table-column>
          <el-table-column prop="compName"
                           label="生产厂家">
          </el-table-column>
          <el-table-column prop="approvalCode"
                           label="批准文号">
          </el-table-column>
          <el-table-column prop="doseUnit"
                           label="给药单位">
          </el-table-column>
          <el-table-column prop="isSolvent"
                           label="是否溶剂">
          </el-table-column>
          <el-table-column prop="isInject"
                           label="是否注射液">
          </el-table-column>
          <el-table-column prop="address"
                           label="抗菌药级别">
          </el-table-column>
        </el-table>
      </div>
    </el-card>
  </div>
</template>
<script>
import { getdictDrugList } from "@/api/rad"
export default {
  data () {
    return {
      queryInfo: {
        srm: '',
        pageList: 1,
        pageSize: 20,
      },
      total: 0,
      dictDrugList: []
    }
  },
  created: function () {
    this.getdictDrugList()
  },
  methods: {
    async getdictDrugList () {
      let _this = this
      let res = await this.$rad.getdictDrugList({
        srm: this.queryInfo.srm,
        pageList: this.queryInfo.pageList,
        pageSize: this.queryInfo.pageSize
      })
      this.total = res.total
      this.dictDrugList = res.rows
      console.log(res)
    }
  }
}
</script>
<style>
.SearchCard {
  height: 50px;
  font-size: 12px;
}
.SearchTitle {
  height: 50px;
  display: flex;
  justify-content: center;
  align-items: center;
  border-right: 1px solid #c2c2c2;
}
.SearchLable {
  height: 50px;
  display: flex;
  justify-content: center;
  align-items: center;
}
.TableCard {
  margin-left: 3px;
  margin-top: 2px;
}
</style>